Quote Originally Posted by laserlight View Post
You expand each recursive call exactly once. That is, you won't write:
Code:
return power(x, n / 2) * power(x, n / 2);
Rather, you will write:
Code:
int result = power(x, n / 2);
return result * result;
I see, you're right. I was just thinking in terms of how the OP had it and how I suggested he fix it, without thinking about the intent of doing it that way instead of x * pow(x, n-1).